package com.kds.smarthome.mapper;

import com.kds.smarthome.entity.Building;
import com.kds.smarthome.common.EnergyType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface BuildingMapper {
    List<Building> findAll();
    Building findById(Integer tid);
    Building findByCode(String code);
    void insert(Building building);
    void update(Building building);
    void delete(Integer tid);
    List<Building> findByUsername(String username);
    void insertUserBuilding(@Param("username") String username, @Param("buildingCode") String buildingCode);
    void deleteUserBuilding(@Param("username") String username, @Param("buildingCode") String buildingCode);

    List<String> findUsersByBuildingCode(String buildingCode);
    
    // 添加与建筑能源类型相关的方法
    void insertBuildingEnergy(@Param("buildingCode") String buildingCode, @Param("energyType") EnergyType energyType);
    void deleteBuildingEnergy(@Param("buildingCode") String buildingCode, @Param("energyType") EnergyType energyType);
    void deleteAllBuildingEnergies(String buildingCode);
    List<EnergyType> findEnergyTypesByBuildingCode(String buildingCode);
}
